From a02b628e07216a30ef7266b3f123ee663f929abc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Mon, 16 Feb 2026 21:45:09 +0100 Subject: [PATCH] search: Remove callback on updateSearch and only rely on async API Using a callback in an async function does not make much sense, so let's just use the async API Part-of: --- js/ui/search.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/js/ui/search.js b/js/ui/search.js index 32a934f43..361475e2f 100644 --- a/js/ui/search.js +++ b/js/ui/search.js @@ -250,12 +250,11 @@ const SearchResultsBase = GObject.registerClass({ }); } - async updateSearch(providerResults, terms, callback) { + async updateSearch(providerResults, terms) { this._terms = terms; if (providerResults.length === 0) { this._clearResultDisplay(); this.hide(); - callback(); } else { const maxResults = this._getMaxDisplayedResults(); const results = maxResults > -1 @@ -275,10 +274,8 @@ const SearchResultsBase = GObject.registerClass({ resultId => this._addItem(this._resultDisplays[resultId])); this._setMoreCount(this.provider.canLaunchSearch ? moreCount : 0); this.show(); - callback(); } catch { this._clearResultDisplay(); - callback(); } } } @@ -705,7 +702,7 @@ export const SearchResultsView = GObject.registerClass({ } this._results[provider.id] = results; - this._updateResults(provider, results); + await this._updateResults(provider, results); } _doSearch() { @@ -851,16 +848,18 @@ export const SearchResultsView = GObject.registerClass({ } } - _updateResults(provider, results) { + async _updateResults(provider, results) { const terms = this._terms; const display = provider.display; - display.updateSearch(results, terms, () => { + try { + await display.updateSearch(results, terms); + } finally { provider.searchInProgress = false; this._maybeSetInitialSelection(); this._updateSearchProgress(); - }); + } } activateDefault() { -- 2.39.5